package com.xiaocg.iterator;

public class IteratorTest {

    public static void main(String[] args) {

        StudentAggrImpl impl = new StudentAggrImpl();
        impl.add(new Student("张三","001"));
        impl.add(new Student("李四","002"));
        impl.add(new Student("王五","003"));

        StudentIterator iterator = impl.getIterator();
        while (iterator.hasNext()){
            Student next = iterator.next();
            System.out.println(next);
        }

    }
}
